Skip to content

[Jobs] Add scheduled jobs api #3306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

[Jobs] Add scheduled jobs api #3306

wants to merge 6 commits into from

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Aug 14, 2025

I went with this syntax, let me know what you think:

hf jobs scheduled run hourly ubuntu echo hello world
hf jobs scheduled ps -a
hf jobs scheduled inspect <id>
hf jobs scheduled delete <id>
hf jobs scheduled suspend <id>
hf jobs scheduled resume <id>
hf jobs scheduled uv run weekly train.py

and

schedule_job(image="ubuntu", command=["echo", "hello world"], schedule="hourly")
list_scheduled_jobs()
inspect_scheduled_job(scheduled_job_id)
delete_scheduled_job(scheduled_job_id)
suspend_scheduled_job(scheduled_job_id)
resume_scheduled_job(scheduled_job_id)
schedule_uv_job("train.py", schedule="weekly")

Current limitations:

  1. there is no way to pass secrets atm
    • therefore local uv script are not working (the token to download the script from the private repo on HF is missing)
  2. there is no way to pass a space ID for the docker image atm

Note before merging: double check the jobSpec used as input when scheduling a job in case we rename "env" -> "environment" to align with the rest of the HTTP API

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants